﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Threading;

namespace IDE_week2
{
    public partial class Form1 : Form
    {

        public static bool Arabic = false;

        public Form1()
        {
            InitializeComponent();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            //to show a form in another
            Form2 Form = new Form2();
            Form.Show();
        }

        private void btReset_Click(object sender, EventArgs e)
        {
            //to reset the default Icon
            Icon = default(Icon);
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void btChangeLang_Click(object sender, EventArgs e)
        {
            //to change a language to another and give it back
            if (!Arabic)
                {
                    ChangeLanguage("ar-OM");
                    Arabic = true;
                }
                else
                {
                    ChangeLanguage("en");
                    Arabic = false;
                }
        }

        private void ChangeLanguage(string lang)
        {
            foreach (Control c in this.Controls)
            {
                ComponentResourceManager resources = new ComponentResourceManager(typeof(Form1));
                resources.ApplyResources(c, c.Name, new CultureInfo(lang));
            }
        }

        private void btChangeIcon_Click(object sender, EventArgs e)
        {
            //to change Icon
            Icon = Properties.Resources.Icon1;
        }

        private void btCall_Click(object sender, EventArgs e)
        {
            int[] numbers = new int[10];
            Class1.MakeRandomNumber(numbers);
            textBox1.Text = numbers[0] + ", " + numbers[1] + ", " + numbers[2];
        }
    }
}
